package com.legendshop.openportal.sdk.annotation;

import com.legendshop.openportal.sdk.validator.DateValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * @author jzh
 * @version 1.0.0
 * @title DateValid
 * @date 2025/5/14 11:18
 * @description：时间格式校验注解
 */
@Target({ElementType.FIELD,ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = {DateValidator.class})
public @interface DateValid {

    /**
     * 错误提示信息
     * @return
     */
    String message() default "时间格式不正确";

    /**
     * 时间格式
     * @return
     */
    String pattern() default "yyyy-MM-dd";

    /**
     * 是否忽略空值
     */
    boolean ignoreEmpty() default false;

    /**
     * 作用参考@Validated和@Valid的区别
     *
     * @return
     */
    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
